package com.sfh.cp.home.child;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.sfh.cp.base.RefreshRecyleFragment;
import com.sfh.cp.home.child.adapter.ContentAdapter;
import com.sfh.cp.mass.MassAddMessageActivity;
import com.sfh.cp.mass.MassNoteActivity;
import com.sfh.cp.mass.MassUserActivity;
import com.sfh.cp.util.look.LookActivity;
import com.sfh.cp.widget.IContentOnClickLayout;
import com.sfh.cp.widget.WidgetContentImageLayout;
import com.sfh.lib.ui.dialog.DialogBuilder;

import java.util.Arrays;

import crm.sfh.server.entity.EContent;
import crm.sfh.server.entity.ENote;
import crm.sfh.server.entity.EUser;

/**
 * 功能描述:
 *
 * @date 2018/6/7
 */
public abstract class BaseChildNoteFragment extends RefreshRecyleFragment implements IContentOnClickLayout {

    protected int nowPage = 1;

    @Override
    public BaseQuickAdapter createAdapter() {
        return new ContentAdapter(this);
    }

    @Override
    public boolean loadMore() {
        return true;
    }

    @Override
    public void onClickMessage(View v, ENote contentType) {

        MassAddMessageActivity.startUI(getActivity(), contentType);
    }

    @Override
    public void onClickImage(View v, ENote contentType, int position) {
        LookActivity.startUI(getActivity(), position, Arrays.asList(contentType.getContent().split(";")));
    }

    @Override
    public void onClickUser(View v, EUser user) {
        MassUserActivity.startUI(getActivity(), user.getUserId());
    }

    @Override
    public void onWealthCharm(View v, EUser user) {

        DialogBuilder builder = new DialogBuilder.Builder().setTitle("魅力值与财富值").setMessage("收到礼物，发帖，签到获得相应魅力值与财富值").build();
        showDialog(builder);

    }

    @Override
    public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
        EContent note = (EContent) adapter.getItem(position);
        MassNoteActivity.startUI(getContext(), note.getContentType());
    }
}
